using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._TileCache
{
    /// <summary>
    /// <para>Manage Tile Cache</para>
    /// <para>Creates a tile cache or updates tiles in an existing tile cache. You can use this tool to create new tiles, replace missing tiles, overwrite outdated tiles, and delete tiles.</para>
    /// <para>创建切片缓存或更新现有切片缓存中的切片。您可以使用此工具创建新切片、替换缺失的切片、覆盖过时的切片以及删除切片。</para>
    /// </summary>    
    [DisplayName("Manage Tile Cache")]
    public class ManageTileCache : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ManageTileCache()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_cache_location">
        /// <para>Cache Location</para>
        /// <para>The folder in which the cache dataset is created or the path to an existing tile cache.</para>
        /// <para>用于创建缓存数据集的文件夹或现有切片缓存的路径。</para>
        /// </param>
        /// <param name="_manage_mode">
        /// <para>Manage Mode</para>
        /// <para><xdoc>
        ///   <para>The mode for managing the cache.</para>
        ///   <bulletList>
        ///     <bullet_item>Recreate all tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed or if layers have been added to a multilayer cache.</bullet_item><para/>
        ///     <bullet_item>Recreate empty tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged.</bullet_item><para/>
        ///     <bullet_item>Delete tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于管理缓存的模式。</para>
        ///   <bulletList>
        ///     <bullet_item>重新创建所有切片 - 如果范围已更改或图层已添加到多图层缓存中，则将替换现有切片并添加新切片。</bullet_item><para/>
        ///     <bullet_item>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。</bullet_item><para/>
        ///     <bullet_item>删除切片 - 将从缓存中删除切片。缓存文件夹结构不会被删除。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public ManageTileCache(object _in_cache_location, _manage_mode_value _manage_mode)
        {
            this._in_cache_location = _in_cache_location;
            this._manage_mode = _manage_mode;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Manage Tile Cache";

        public override string CallName => "management.ManageTileCache";

        public override List<string> AcceptEnvironments => ["parallelProcessingFactor"];

        public override object[] ParameterInfo => [_in_cache_location, _manage_mode.GetGPValue(), _in_cache_name, _in_datasource, _tiling_scheme.GetGPValue(), _import_tiling_scheme, _scales, _area_of_interest, _max_cell_size, _min_cached_scale, _max_cached_scale, _out_cache_location];

        /// <summary>
        /// <para>Cache Location</para>
        /// <para>The folder in which the cache dataset is created or the path to an existing tile cache.</para>
        /// <para>用于创建缓存数据集的文件夹或现有切片缓存的路径。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cache Location")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_cache_location { get; set; }


        /// <summary>
        /// <para>Manage Mode</para>
        /// <para><xdoc>
        ///   <para>The mode for managing the cache.</para>
        ///   <bulletList>
        ///     <bullet_item>Recreate all tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed or if layers have been added to a multilayer cache.</bullet_item><para/>
        ///     <bullet_item>Recreate empty tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged.</bullet_item><para/>
        ///     <bullet_item>Delete tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于管理缓存的模式。</para>
        ///   <bulletList>
        ///     <bullet_item>重新创建所有切片 - 如果范围已更改或图层已添加到多图层缓存中，则将替换现有切片并添加新切片。</bullet_item><para/>
        ///     <bullet_item>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。</bullet_item><para/>
        ///     <bullet_item>删除切片 - 将从缓存中删除切片。缓存文件夹结构不会被删除。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Manage Mode")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _manage_mode_value _manage_mode { get; set; }

        public enum _manage_mode_value
        {
            /// <summary>
            /// <para>Recreate all tiles</para>
            /// <para>Recreate all tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed or if layers have been added to a multilayer cache.</para>
            /// <para>重新创建所有切片 - 如果范围已更改或图层已添加到多图层缓存中，则将替换现有切片并添加新切片。</para>
            /// </summary>
            [Description("Recreate all tiles")]
            [GPEnumValue("RECREATE_ALL_TILES")]
            _RECREATE_ALL_TILES,

            /// <summary>
            /// <para>Recreate empty tiles</para>
            /// <para>Recreate empty tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged.</para>
            /// <para>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。</para>
            /// </summary>
            [Description("Recreate empty tiles")]
            [GPEnumValue("RECREATE_EMPTY_TILES")]
            _RECREATE_EMPTY_TILES,

            /// <summary>
            /// <para>Delete tiles</para>
            /// <para>Delete tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</para>
            /// <para>删除切片 - 将从缓存中删除切片。缓存文件夹结构不会被删除。</para>
            /// </summary>
            [Description("Delete tiles")]
            [GPEnumValue("DELETE_TILES")]
            _DELETE_TILES,

        }

        /// <summary>
        /// <para>Cache Name</para>
        /// <para>Name of the cache dataset to be created inside the cache location.</para>
        /// <para>要在缓存位置内创建的缓存数据集的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cache Name")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_cache_name { get; set; } = null;


        /// <summary>
        /// <para>Input Data Source</para>
        /// <para><xdoc>
        ///   <para>A raster dataset, mosaic dataset, or map file.</para>
        ///   <para>This parameter is not required when Delete tiles is specified in the Manage Mode parameter.</para>
        ///   <para>A map file (.mapx) cannot contain a map service or image service.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>栅格数据集、镶嵌数据集或地图文件。</para>
        ///   <para>在管理模式参数中指定删除切片时，不需要此参数。</para>
        ///   <para>地图文件 （.mapx） 不能包含地图服务或影像服务。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Data Source")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_datasource { get; set; } = null;


        /// <summary>
        /// <para>Input Tiling Scheme</para>
        /// <para><xdoc>
        ///   <para>An optional parameter to specify the tiling scheme.</para>
        ///   <bulletList>
        ///     <bullet_item>ArcGIS Online scheme—Use the default ArcGIS Online tiling scheme.</bullet_item><para/>
        ///     <bullet_item>Import scheme—Import an existing tiling scheme.</bullet_item><para/>
        ///     <bullet_item>Elevation tiling scheme—Use this tiling scheme for elevation services.</bullet_item><para/>
        ///     <bullet_item>WGS84 Version 2 tiling scheme—Use this tiling scheme based on WGS84 Version 2.</bullet_item><para/>
        ///     <bullet_item>WGS84 Version 2 elevation tiling scheme— Use this tiling scheme based on WGS84 Version 2 to build tile cache for elevation data.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于指定切片方案的可选参数。</para>
        ///   <bulletList>
        ///     <bullet_item>ArcGIS Online 方案 - 使用默认的 ArcGIS Online 切片方案。</bullet_item><para/>
        ///     <bullet_item>导入方案 （Import scheme） - 导入现有切片方案。</bullet_item><para/>
        ///     <bullet_item>高程切片方案 - 将此切片方案用于高程服务。</bullet_item><para/>
        ///     <bullet_item>WGS84 版本 2 切片方案 - 使用基于 WGS84 版本 2 的切片方案。</bullet_item><para/>
        ///     <bullet_item>WGS84 版本 2 高程切片方案 - 使用基于 WGS84 版本 2 的切片方案为高程数据构建切片缓存。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Tiling Scheme")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _tiling_scheme_value _tiling_scheme { get; set; } = _tiling_scheme_value._ARCGISONLINE_SCHEME;

        public enum _tiling_scheme_value
        {
            /// <summary>
            /// <para>ArcGIS Online scheme</para>
            /// <para>ArcGIS Online scheme—Use the default ArcGIS Online tiling scheme.</para>
            /// <para>ArcGIS Online 方案 - 使用默认的 ArcGIS Online 切片方案。</para>
            /// </summary>
            [Description("ArcGIS Online scheme")]
            [GPEnumValue("ARCGISONLINE_SCHEME")]
            _ARCGISONLINE_SCHEME,

            /// <summary>
            /// <para>Elevation tiling scheme</para>
            /// <para>Elevation tiling scheme—Use this tiling scheme for elevation services.</para>
            /// <para>高程切片方案 - 将此切片方案用于高程服务。</para>
            /// </summary>
            [Description("Elevation tiling scheme")]
            [GPEnumValue("ARCGISONLINE_ELEVATION_SCHEME")]
            _ARCGISONLINE_ELEVATION_SCHEME,

            /// <summary>
            /// <para>WGS84 Version 2 tiling scheme</para>
            /// <para>WGS84 Version 2 tiling scheme—Use this tiling scheme based on WGS84 Version 2.</para>
            /// <para>WGS84 版本 2 切片方案 - 使用基于 WGS84 版本 2 的切片方案。</para>
            /// </summary>
            [Description("WGS84 Version 2 tiling scheme")]
            [GPEnumValue("WGS84_V2_SCHEME")]
            _WGS84_V2_SCHEME,

            /// <summary>
            /// <para>WGS84 Version 2 elevation tiling scheme</para>
            /// <para>WGS84 Version 2 elevation tiling scheme— Use this tiling scheme based on WGS84 Version 2 to build tile cache for elevation data.</para>
            /// <para>WGS84 版本 2 高程切片方案 - 使用基于 WGS84 版本 2 的切片方案为高程数据构建切片缓存。</para>
            /// </summary>
            [Description("WGS84 Version 2 elevation tiling scheme")]
            [GPEnumValue("WGS84_V2_ELEVATION_SCHEME")]
            _WGS84_V2_ELEVATION_SCHEME,

            /// <summary>
            /// <para>Import scheme</para>
            /// <para>Import scheme—Import an existing tiling scheme.</para>
            /// <para>导入方案 （Import scheme） - 导入现有切片方案。</para>
            /// </summary>
            [Description("Import scheme")]
            [GPEnumValue("IMPORT_SCHEME")]
            _IMPORT_SCHEME,

        }

        /// <summary>
        /// <para>Import Tiling Scheme</para>
        /// <para>Path to an existing scheme file (.xml) or imported from an existing image service or map service.</para>
        /// <para>现有方案文件 （.xml） 的路径，或从现有影像服务或地图服务导入的路径。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Import Tiling Scheme")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _import_tiling_scheme { get; set; } = null;


        /// <summary>
        /// <para>Scales [Pixel Size] (Estimated Disk Space)</para>
        /// <para><xdoc>
        ///   <para>The scale levels at which you will create or delete tiles when running this tool, depending on the value of the Manage Mode parameter. The pixel size is represented based on the spatial reference of the tiling scheme.</para>
        ///   <bulletList>
        ///     <bullet_item>By default, only the scales within Minimum Cached Scale and Maximum Cached Scale will be checked on.</bullet_item><para/>
        ///     <bullet_item>Altering the value of either the Minimum Cached Scale or the Maximum Cached Scale parameter will check on or off the appropriate scale values.</bullet_item><para/>
        ///     <bullet_item>Scales checked on and not within the range of Minimum Cached Scale or Maximum Cached Scale are ignored when generating the cache.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>运行此工具时创建或删除切片的规模级别，具体取决于管理模式参数的值。像素大小根据切片方案的空间参考表示。</para>
        ///   <bulletList>
        ///     <bullet_item>默认情况下，仅选中“最小缓存比例”和“最大缓存比例”中的比例。</bullet_item><para/>
        ///     <bullet_item>更改“最小缓存比例”或“最大缓存比例”参数的值将检查是否打开或关闭相应的比例值。</bullet_item><para/>
        ///     <bullet_item>生成缓存时，选中且不在“最小缓存比例”或“最大缓存比例”范围内的比例将被忽略。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Scales [Pixel Size] (Estimated Disk Space)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _scales { get; set; } = null;


        /// <summary>
        /// <para>Area of Interest</para>
        /// <para><xdoc>
        ///   <para>Defines an area of interest to constrain where tiles will be created or deleted.</para>
        ///   <para>It can be a feature class, or it can be a feature set that you interactively define.</para>
        ///   <para>This parameter is useful if you want to manage tiles for irregularly shaped areas. It's also useful in situations where you want to precache some areas and leave less-visited areas uncached.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义感兴趣区域以限制切片的创建或删除位置。</para>
        ///   <para>它可以是要素类，也可以是以交互方式定义的要素集。</para>
        ///   <para>如果要管理形状不规则区域的图块，则此参数非常有用。在您想要预缓存某些区域并保留未缓存访问较少的区域的情况下，它也很有用。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Area of Interest")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _area_of_interest { get; set; } = null;


        /// <summary>
        /// <para>Maximum Source Cell Size</para>
        /// <para><xdoc>
        ///   <para>The value that defines the visibility of the data source for which the cache will be generated. By default, the value is empty.</para>
        ///   <para>If the value is empty</para>
        ///   <bulletList>
        ///     <bullet_item>For levels of cache that lie within the visibility ranges of the data source, the cache is generated from the data source.</bullet_item><para/>
        ///     <bullet_item>For levels of cache that fall outside the visibility of the data source, the cache is generated from the previous level of cache.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>If the value is greater than zero</para>
        ///   <bulletList>
        ///     <bullet_item>For levels with cell sizes smaller than or equal to Maximum Source Cell Size (max_cell_size), the cache is generated from the data source.</bullet_item><para/>
        ///     <bullet_item>For levels with cell sizes greater than Maximum Source Cell Size (max_cell_size), the cache is generated from the previous level of cache.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>The unit of the Maximum Source Cell Size value should be the same as the unit of the cell size of the source dataset.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义将为其生成缓存的数据源的可见性的值。默认情况下，该值为空。</para>
        ///   <para>如果值为空</para>
        ///   <bulletList>
        ///     <bullet_item>对于位于数据源可见性范围内的缓存级别，将从数据源生成缓存。</bullet_item><para/>
        ///     <bullet_item>对于超出数据源可见性的缓存级别，缓存将从以前的缓存级别生成。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>如果该值大于零</para>
        ///   <bulletList>
        ///     <bullet_item>对于像元大小小于或等于最大源像元大小 （max_cell_size） 的级别，将从数据源生成缓存。</bullet_item><para/>
        ///     <bullet_item>对于像元大小大于最大源像元大小 （max_cell_size） 的级别，缓存将从上一个缓存级别生成。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>最大源像元大小值的单位应与源数据集的像元大小单位相同。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Source Cell Size")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _max_cell_size { get; set; } = null;


        /// <summary>
        /// <para>Minimum Cached Scale</para>
        /// <para>The minimum scale at which you want to create tiles. This does not have to be the smallest scale in your tiling scheme. Your minimum cache scale will determine which scales are used when generating cache.</para>
        /// <para>要创建切片的最小比例。这不一定是切片方案中的最小比例。最小缓存比例将决定生成缓存时使用哪些比例。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Cached Scale")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _min_cached_scale { get; set; } = null;


        /// <summary>
        /// <para>Maximum Cached Scale</para>
        /// <para>The maximum scale at which you want to create tiles. This does not have to be the largest scale in your tiling scheme. The maximum cache scale will determine which scales are used when generating cache.</para>
        /// <para>要创建切片的最大比例。这不一定是切片方案中的最大比例。最大缓存比例将决定生成缓存时使用哪些比例。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Cached Scale")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _max_cached_scale { get; set; } = null;


        /// <summary>
        /// <para>Cache Name</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cache Name")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_cache_location { get; set; }


        public ManageTileCache SetEnv(object parallelProcessingFactor = null)
        {
            base.SetEnv(parallelProcessingFactor: parallelProcessingFactor);
            return this;
        }

    }

}